package com.xinnet.mms.customerManage.service;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.xinnet.core.utils.page.PageView;
import com.xinnet.mms.entity.Area;
import com.xinnet.mms.entity.CustomMixAudit;
import com.xinnet.mms.entity.Customer;
import com.xinnet.mms.entity.CustomerCare;
import com.xinnet.mms.entity.CustomerRemark;
import com.xinnet.mms.entity.Dept;
import com.xinnet.mms.entity.Emp;
import com.xinnet.mms.entity.Product;
import com.xinnet.mms.entity.PushHistory;
import com.xinnet.mms.entity.PushResults;
import com.xinnet.mms.entity.ShopCart;


@Service
public interface CustomerManageService {
	
	/**
	 * 
	 * 方法描述：查询客户
	 * 
	 *@param pageView 分页插件
	 *@param customer 客户
	 *@param emp 当前登录用户
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-1-21 上午10:43:39
	 * @throws Exception 
	 */
	public PageView<Customer> queryCustomer(PageView<Customer> pageView,Customer customer) throws Exception;
	
	public List<ShopCart> queryShopCartCustomer(ShopCart shopCart)  throws Exception;
	
	/**
	 * 
	 * 方法描述：查询客户(新)
	 * 
	 *@param customer 客户
	 *@return
	 *
	 * @author 王志军
	 *
	 *	       2016-9-05 上午16:43:39
	 * @throws Exception 
	 */
	public List<Customer> queryCustomer(Customer customer) throws Exception;
	
	/**
	 * 
	 * 方法描述：添加报备客户
	 * 
	 *@param customer 客户VO
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-2-7 下午3:27:11
	 */
	public Customer addReportedCustomer(Customer customer);
	
	public void delCustomerByIds(String customerIdStr);
	
	public void accept(Customer customer);
	
	/**
	 * 
	 * 方法描述：添加人员客户记录
	 * 
	 *@param empCustomer
	 *@param customer
	 *@param emp
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-3-5 上午9:55:08
	 */
	public void addEmpCustomer(Customer customer, Emp emp);
	
	public Customer getById(Long id);
	
	public Customer findByCustomerName(String customerName);
	
	public List<Customer> getAllCustom();
	
	public void updateCustomer(Customer customer);
	
	public void updateCustomerProduct(Customer customer);
	
	public void  goOpenSea(Customer customer);
	
	
	/**
	 * 
	 * 方法描述：通过产品ID查询出所对应的组织结构 推送客户时用
	 * 
	 *@param customerId
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-1-24 下午2:56:58
	 */
	public List<Dept> getDeptByProductIds(String[ ] productIds,String companyId);
	
	public void delCustomByCname(String customName);
	
	/**
	 * 
	 * 方法描述：根据部门ID获取所对应的区域
	 * 
	 *@param deptId
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-2-18 下午2:04:01
	 */
	public List<Area> getAreaByDeptId(String deptId);
	
	public void addCustom(Customer customer);
	
	/**
	 * 
	 * 方法描述：修改报备客户
	 * 
	 *@param customer客户VO
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-2-7 下午5:34:25
	 */
	public int modifyReportedCustomer(Customer customer);

	public List<Customer> getOfServiceCustomerByEmpNoStr(String empNoStr);
	
	public List<Customer> getDeployCustomByMap(Map<String,Object> paramMap);
	
	public Integer getDeployCustomCountByMap(Map<String,Object> paramMap);
	//public List<Customer> getDeployCustomByDeptIdAndApplyerId(String deptId,String applyerId);
	
	public int addCustomMixAudit(CustomMixAudit customMixAudit);
	
	public List<CustomMixAudit> getAllCustomMixAudit();
	
	public List<Customer>  getDeployCustomByParam(Map<String, Object> param);
	
	public Integer  getDeployCustomCountByParam(Map<String, Object> param);
	
	public List<CustomMixAudit> getCustomDeployApprovalItems(String deptIdStr,String approvalerId);
	
	public List<CustomMixAudit> getCustomMixAudit(Map<String,Object> param);
	
	public Integer getCustomMixAuditCount(Map<String,Object> param);

	public int updateCustomMixAudit(CustomMixAudit customMixAudit) throws Exception ;

	/**
	 * 
	 * 方法描述：根据父产品ID来获取产品
	 * 
	 *@param parentId
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-2-21 下午1:17:29
	 */
	public List<Product> getProductByParentId(String parentId);
	
	/**
	 * 
	 * 方法描述：通过条件获取客户服务（订单）
	 * 
	 *@param customerId
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-2-24 上午11:06:33
	 */
	public List<CustomerCare> getCustomerCareListByCondition(CustomerCare customerCare);

	/**
	 * 
	 * 方法描述：通过客户ID查询出该客户未被推送过的产品
	 * 
	 *@param cusId
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-2-25 下午2:42:32
	 */
	public List<Product> getNotPushProductByCustomerId(String cusId);
	
	/**
	 * 
	 * 方法描述：查询客户备注
	 * 
	 *@param pageView
	 *@param customerRemark
	 *@param emp
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-2-26 上午10:54:59
	 */
	public PageView<CustomerRemark> queryCustomerRemark(PageView<CustomerRemark> pageView,CustomerRemark customerRemark, Emp emp);
	
	/**
	 * 
	 * 方法描述：查询客户备注
	 * 
	 *@param pageView
	 *@param customerRemark
	 *@param emp
	 *@return
	 *
	 * @author 王志军[lilihua@xinnet.com]
	 *
	 *	       2014-2-26 上午10:54:59
	 */
	public List<CustomerRemark> queryCustomerRemark(CustomerRemark customerRemark);

	/**
	 * 
	 * 方法描述：添加客户备注
	 * 
	 *@param customerRemark
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-2-26 上午10:52:48
	 */
	public void addCustomerRemark(CustomerRemark customerRemark);
	
	/**
	 * 
	 * 方法描述：修改客户备注
	 * 
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-3-5 下午2:03:45
	 */
	public void modifyCustomerRemarkById(CustomerRemark customerRemark);

	/**
	 * 
	 * 方法描述：通过客户ID集合获取客户
	 * 
	 *@param cusIdArray
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-2-28 下午4:21:27
	 */
	public List<Customer> getCustomerByIdArray(String[] cusIdArray);

	/**
	 * 
	 * 方法描述：通过客户ID修改客户
	 * 
	 *@param customer
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-3-5 上午11:21:54
	 */
	public void modifyCustomerById(Customer customer);
	/**
	 * 
	 * 功能描述：删除400客户
	 *
	 * @param cusId
	 *
	 * @author 王湛智[wangzhanzhi@xinnet.com]
	 *
	 * @since 2014年3月11日
	 *
	 * @update:[变更日期YYYY-MM-DD][更改人姓名][变更描述]
	 */
	public void del400Customer(String cusId);

	
	/**
	 * 
	 * 方法描述：根据销售人员ID 跟 产品ID查询推送历史表 获取推送个数 用于首页展示意向客户 推送个数
	 * 
	 *@param statPushResults
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-3-13 下午4:07:44
	 */
	public List<PushResults> getPushNumber(PushResults pushResults);
	
	/**
	 * 
	 * 方法描述：根据员工部门ID获取员工
	 * 
	 *@param deptId
	 *@return
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-3-19 下午1:19:03
	 */
	public List<Emp> getEmpListByDeptId(String deptId);
	
	/**
	 * 客户调配审批
	 * @param id
	 * @param isEffect
	 * @throws SQLException
	 */
	public void customDeployApproval(String id,String isEffect)throws Exception;
	/**
	 * 客户调配批量审批
	 * @param id
	 * @param isEffect
	 * @throws SQLException
	 */
	public void customDeployBathApproval(String idStr,String isEffect)throws Exception;
	
	/**
	 * 
	 * 方法描述：回收客户时 将该客户在推送历史表中的 "是否被回收"字段改为 是（1）
	 * 
	 *@param cusId
	 *
	 * @author 李丽华[lilihua@xinnet.com]
	 *
	 *	       2014-3-21 下午4:37:20
	 */
	public void updateIsRecyclingByCusId(String cusId);

	
	public String getDeptChildrenId(String deptId);

	/**
	 * 根据流传历史ID查询记录
	 * @param pushHistoryId  流转历史ID
	 */
	public PushHistory getPushHistoryById(String pushHistoryId);

	/**
	 * 通过产品ID 获取产品
	 * @param string
	 * @return
	 */
	public Product getProductByProductId(String productId);
	
	/**
	 * 通过销售ID与客户状态获取客户
	 * @param page 分页插件
	 * @param customer 客户VO
	 * @return
	 */
	public PageView<Customer> getCustomerByEmpIdAndCustomState(PageView<Customer> page, Customer customer);

	/**
	 * 获取所有产品
	 * @return
	 */
	public List<Product> getAllProduct();
	
	
	public Customer getDeployCustomByCustomMixId(String customMixId);
	
	/**
	 * 获取所有未接收的客户
	 * @param customer
	 * @return
	 */
	public List<Customer> getAllNotAcceptCustom(Customer customer);

	/**
	 * 查询即将到期商品
	 * @param page
	 * @param customer
	 * @return
	 * @throws Exception 
	 */
	public PageView<Customer> queryDueSoonGoods(PageView<Customer> page,
			Customer customer) throws Exception;

	/**
	 * 通过客户类型获取未接收的客户
	 * @param customer
	 * @return
	 */
	public Integer getAcceptNoCustomerCountByCustomType(Customer customer) throws Exception;

	/**
	 * 获取即将流走客户的数量
	 * @param customer
	 * @return
	 */
	public Integer getVanishSoonCustomerCount(Customer customer) throws SQLException ;

	/**
	 * 查询公海客户
	 * @param page
	 * @param customer
	 * @return
	 */
	public PageView<Customer> queryOpenSeeCustomer(PageView<Customer> page,Customer customer) throws Exception;
	
	
	public List<CustomMixAudit> getCustomDeployApprovalItemsByMap(Map<String,Object> paramMap);
	
	public Integer getCustomDeployApprovalItemsCountByMap(Map<String,Object> paramMap);
	//获取加入购物车会员的数量
	public Integer addShopCartCustomerCount(Customer customer) throws Exception;

	public Integer findAllfitCustomNum(Customer customer);

	public List<Customer> findAllMindCustom(Customer customer);

	public List<Customer> findAllWaitChargeCustom(Customer customer);

	public List<Customer> findAllProtectCustom(Customer customer);

	public List<Customer> findAllSecondCustom(Customer customer);
	
	public Integer getCustomerCount(Customer customer);
}
